#include <linux/init.h>
#include <linux/module.h>
#include <linux/of.h>
/*
mynode@0x12345678{
 string = "DC22041 everyone!!";
 uint   = <0x11223344 0xaabbccdd>;
 macaddr=[00 0c 29 7b f9 be];
 mixed = "hello",<0x112233>,[aa cc 00 12];
};
*/
struct device_node* node;
struct property *p;
static int __init mynode_init(void)
{
    int len,i;
    //通过路径获取节点
    node = of_find_node_by_path("/mynode@0x12345678");
    if (node == NULL) {
        printk("get node error\n");
        return -ENODATA;
    }
    p = of_find_property(node,"mixed",&len);
    if(p == NULL){
        printk("get property error\n");
        return -ENODATA;
    }

    printk("%s\n",(char *)p->value);
    printk("%#x\n",__be32_to_cpup(p->value+6));
    for(i=0;i<4;i++){
        printk("%#x\n",*(unsigned char *)(p->value+10+i));
    }

    return 0;
}
static void __exit mynode_exit(void)
{
}
module_init(mynode_init);
module_exit(mynode_exit);
MODULE_LICENSE("GPL");